home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr05 / mswlogo3.zip / MSWLOGO.ZIP / LOGOLIB.ZIP / FOREACH < prev    next >
Text File  |  1992-10-28  |  667b  |  24 lines

  1. .macro foreach [:foreach.inputs] 2
  2. catch "foreach.catchtag ~
  3.       [op foreach.done runresult ~
  4.         [foreach1 bl :foreach.inputs last :foreach.inputs 1]]
  5. op []
  6. end
  7.  
  8. to foreach1 :template.lists :foreach.template :template.number
  9. if emptyp first :template.lists [throw "foreach.catchtag]
  10. apply :foreach.template firsts :template.lists
  11. .maybeoutput foreach1 bfs :template.lists :foreach.template :template.number+1
  12. end
  13.  
  14. to foreach.done :foreach.result
  15. if emptyp :foreach.result [op [stop]]
  16. op list "output quoted first :foreach.result
  17. end
  18.  
  19. to ?rest [:which 1]
  20. output bf item :which :template.lists
  21. end
  22.  
  23. bury [foreach foreach1 foreach.done ?rest]
  24.